package com.atguigu.gmall.all.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ：MJS
 * @date ：Created in 2021/5/13  19:26
 * @description：TODO
 */
@Controller
public class HelloController {
    //测试  Springmvc  + Spring + mybatis   SSM   SpringBoot   Spring伟大理想  Spring时零配置
    @GetMapping("/hello")
    public String hello(Model model, HttpSession session){
        model.addAttribute("hello","世界你好");
        session.setAttribute("hh","我是Session中的值");
        List<String> list = new ArrayList<>();
        list.add("范伟");
        list.add("小无此");
        list.add("赵本山");
        model.addAttribute("list",list);
        model.addAttribute("num",10);
        model.addAttribute("num2",6);
        model.addAttribute("gname","<span style=\"color:green\">宝强</span>");
        return "index";
    }

}
